<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>Title</title>
    <link rel="stylesheet" href="/lib/layui/css/layui.css">
    <link rel="stylesheet" href="/lib/layui/extend/formSelects-v4.css">
</head>
<body>
<div>
    <form id="srchForm" class="layui-form input">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">操作者</label>
                <div class="layui-input-inline">
                    <input type="text" name="userName_like" autocomplete="off"
                           id="operator" class="layui-input">
                </div>
                <label class="layui-form-label">内容</label>
                <div class="layui-input-inline">
                    <input type="text" name="operation_like" autocomplete="off"
                           id="loginType" class="layui-input">
                </div>
                <label class="layui-form-label">时间</label>
                <div class="layui-input-inline" style="width:380px;">
                    <input type="text" name="createTime_range" id="createTime" class="layui-input" placeholder=" - "
                           style="width:360px;" readonly="readonly">
                </div>
                <button lay-submit="" lay-filter="searchBtn"
                        class="layui-btn layui-btn-sm layui-btn-primary table-action">
                    <i class="layui-icon layui-icon-search"></i>点击查询
                </button>
                <button id="resetButton" type="reset" class="layui-btn layui-btn-sm layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
    <table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
</div>
<script type="text/javascript" src="/js/jquery.min.js" charset="utf-8"></script>
<script type="text/javascript" src="/js/commonjs.js" charset="utf-8"></script>
<script src="/lib/layui/layui.js" charset="utf-8"></script>
<script>
    $("#resetButton").mouseover(function () {
        layer.tips('重置查询条件', this, {
            tips: [2, "#4794ec"]
        });
    });
    layui.use(['table', 'form', 'jquery', 'laydate'], function () {
        var table = layui.table;
        var form = layui.form;
        var $ = layui.$;
        var laydate = layui.laydate
        table.render({
            elem: '#dataTable',
            url: '/systemLog/findAllLog',
            //, method: 'POST'
            smartReloadModel: true,
            minWidth: 50,
            cols: [
                [
                    {field: 'userName', title: '操作人'},
                    {
                        field: 'createTime',
                        title: '操作时间时间',
                        templet: "<div>{{layui.util.toDateString(d.createTime, 'yyyy-MM-dd HH:mm:ss')}}</div>"
                    },
                    {field: 'operation', title: '内容'},
                    {field: 'params', title: '参数'},
                    {field: 'ip', title: 'IP地址'},
                ]
            ],
            page: true
        });

        laydate.render({
            elem: '#createTime'
            , type: 'datetime'
            , range: true
        });

        form.on('submit(searchBtn)', function (form) {
            table.reload('dataTable', {
                page: {curr: 1},  // 这句是必须的，重新从第一页开始加载。
                where: form.field
            });
            return false;
        });
    })
</script>
</body>
</html>